#!/bin/bash

# This script sets the unix file modes for pygame files. Specifically it
# sets the executabled bit for any python files starting with the
# '#!/usr/bin/env python' sha-bang. Searching is restricted to the base
# and examples directories. The Pygame policy is to not preserve
# executable mode in SVN. It is left as an end-user choice. It is safe to
# commit executable files as their modes are not copied to SVN.
#

SHA_BANG='^#! */usr/bin/env python'
PROGS="*.py examples/*.py"

for name in `grep -le "$SHA_BANG" $PROGS`
do
  chmod a+x "$name"
done

# Also make sure none of the files in lib/ are executable...
#   like the font file which was in the 1.8.1release.
chmod -x lib/*.ttf
chmod -x lib/*.py
chmod -x lib/threads/*.py
chmod -x lib/gp2x/*.py


